home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UCRASM25.ARJ / PUTI.ASM < prev    next >
Assembly Source File  |  1991-12-13  |  1KB  |  65 lines

  1. StdGrp        group    stdlib,stddata
  2. stddata        segment    para public 'sldata'
  3. stddata        ends
  4. ;
  5. ; Changed Puti2 as per suggestion by David Holm, 10/22/91.
  6. ;
  7. stdlib        segment    para public 'slcode'
  8.         assume    cs:stdgrp
  9.         extrn    sl_putc:far
  10. ;
  11. ; Puti prints the value in AX as a signed integer value.
  12. ;
  13.         public    sl_puti
  14. sl_Puti        proc    far
  15.         push    ax
  16.         cmp    ax, 0
  17.         jge    Doit
  18.         push    ax
  19.         mov    al, '-'
  20.         call    sl_Putc
  21.         pop    ax
  22.         neg    ax
  23. ;
  24. DoIt:        call    puti2
  25.         pop    ax
  26.         ret
  27. sl_Puti        endp
  28. ;
  29. ; Putu prints the value in AX as an unsigned integer value.
  30. ;
  31.         public    sl_PutU
  32. sl_PutU        proc    far
  33.         push    ax
  34.         call    PutI2
  35.         pop    ax
  36.         ret
  37. sl_PutU        endp
  38. ;
  39. ; PutI2- Iterative routine to actually print the value in AX as an integer.
  40. ;     (Submitted by David Holm)
  41. ;
  42. Puti2        proc    near
  43.         push    bx
  44.         push    cx
  45.         push    dx
  46.         mov    bx, 10
  47.         xor    cx, cx
  48. Puti2Lp:    xor    dx, dx
  49.         div    bx
  50.         or    dl, '0'
  51.         push    dx
  52.         inc    cx
  53.         or    ax, ax
  54.         jnz    Puti2Lp
  55. Popi2lp:    pop    ax
  56.         call    sl_putc
  57.         loop    Popi2lp
  58.         pop    dx
  59.         pop    cx
  60.         pop    bx
  61.         ret
  62. PutI2        endp
  63. stdlib        ends
  64.         end
  65.